package com.weavernorth.humanaffairs;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;


/**
 * 定时任务更新入职流程后更新的店铺信息
 */


public class EntryUpStoreTimer extends BaseCronJob {
    public static Log log = LogFactory.getLog(EntryUpStoreTimer.class.getName());

    @Override
    public void execute() {
        BaseBean bb = new BaseBean();
        //数据库操作
        RecordSet rs = new RecordSet();
        RecordSet rsUp = new RecordSet();

        //查询店铺店长编码不为空的数据
        String strSql = "select hr.id,hr.workcode from uf_dpxx ud,hrmresource hr  where ud.djlbh=hr.workcode and  (ud.djlbh is not null  or ud.djlbh!='') and (hr.accounttype=0 or hr.accounttype is null)";
        log.info("查询编码不为空的数据:" + strSql);
        rs.executeQuery(strSql);
        while (rs.next()) {
            //人员id
            String strHrmid = Util.null2String(rs.getString("id"));
            //人员编码
            String strWorkcode = Util.null2String(rs.getString("workcode"));
            //如果有数据,则更新店铺信息的店长字段为当前人员id
            String strUpsql = "update uf_dpxx set djlbh='' ,dc='" + strHrmid + "' where djlbh=?";
            log.info("入职流程更新店铺信息表sql:" + strUpsql + "strHrmid:" + strHrmid + ",djlbh:" + strWorkcode);
            rsUp.executeUpdate(strUpsql, strWorkcode);


        }

    }
}



